<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>HTML-ZMS</title>
    <script>

        function loadfromxml()
        {

            var httprequest;
            httprequest=new XMLHttpRequest();
            httprequest.onreadystatechange=function()
            {
                // alert(httprequest.readyState+"+"+httprequest.status);

                if (httprequest.readyState==4 && httprequest.status==200)
                {
                    xmlDoc=httprequest.responseXML;
                    txt="";
                    x=xmlDoc.getElementsByTagName("title");
                    //  alert(x.length);
                    for (i=0;i<x.length;i++)
                    {
                        txt=txt + x[i].childNodes[0].nodeValue + "<br />";
                    }
                    document.getElementById("myDiv").innerHTML=txt;


                }
                else
                    document.getElementById("myDiv").innerHTML="没拿到";
            }

            httprequest.open("GET","../files/my.xml",true);
            //传递参数 仅用于post ,GET  send()不用写
            httprequest.send();
        }

    </script>

</head>

<body>

<input type="button" value="更新数据" onclick="loadfromxml()">

<div id="myDiv">3333行行行行行行想</div>
</body>
</html>
